namespace xyz {
    /**
     * 右键菜单
     */
  export class ctxmenu {
    private menuUlHtml: HTMLElement;
    private menuHtml: HTMLElement;
    constructor() {
      this.menuUlHtml = document.createElement("ul");
      this.menuHtml = document.createElement("div");
      this.menuHtml.className = "dialog ctxmenu";
      this.menuHtml.appendChild(this.menuUlHtml);
    }
    addMenuItem(html: string, clickevent: () => void) {
      var that = this;
      var li = document.createElement("li");
      li.innerHTML = html;
      li.onclick = function(){ 
          clickevent();
          that.menuHtml.style.display = "none";
        }
      this.menuUlHtml.appendChild(li);
    }
    addMenuTo(html: HTMLElement) {
      var that = this;
      document.body.appendChild(this.menuHtml);
      html.onblur = function() {
        that.menuHtml.style.display = "none";
      };
      html.oncontextmenu = function(ev) {
        that.menuHtml.style.top = ev.pageY + "px";
        that.menuHtml.style.left = ev.pageX + "px";
        that.menuHtml.style.display = "block";
        return false;
      };
    }
  }

  /**
   * 对话框
   */
  export class dialogs{
      constructor(){
        
      }
  }
}
